package com.xxb.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: Mr.Chen
 * @Date: 2018/7/4 11:08
 */
@RestControllerAdvice
@Slf4j
public class MyExceptionHandler {

    @ExceptionHandler(MyException.class)
    public ErrorResponse handler1(MyException e) {
        return ErrorResponse.getInstance().setCode(e.getCode()).setMsg(e.getMsg());
    }

}
